import sys

from util.lib.OS import OS


class STD:
    @staticmethod
    def out(string, path=None):
        if path is not None:
            f = OS.open(path, 'a')
            f.write(string + '\n')
            f.close()
        else:
            print(string)

    @staticmethod
    def die(string=''):
        STD.out(string)
        exit()

    @staticmethod
    def flush(string):
        print(string)
        sys.stdout.flush()

    @staticmethod
    def logD(info):
        STD.out("DEBUG : ")
        STD.out(info)

    @staticmethod
    def logE(info):
        STD.out("ERROR : ")
        STD.out(info)

    @staticmethod
    def logW(info):
        STD.out("WARNING : ")
        STD.out(info)

    @staticmethod
    def logF(info):
        STD.out("FATAL : ")
        STD.out(info)

    @staticmethod
    def logI(info):
        STD.out("INFO : ")
        STD.out(info)
